package com.gjx.clock.entity

import androidx.room.Entity
import androidx.room.PrimaryKey
import java.text.SimpleDateFormat
import java.time.DayOfWeek
import java.util.*

/**
 * 单位是分钟
 * @property workingTime Int
 * @property restTime Int
 * @property enable Boolean
 * @constructor
 */
@Entity  //Room包的注解
data class RestAlarmClock(var workingTime:Int, var restTime:Int, var enable:Boolean) {
    @PrimaryKey(autoGenerate = true)
    var id: Long = 0
}

@Entity
data class NormalAlarmClock(var hour: Int,var minute:Int,var enable:Boolean,var everday:Boolean=false) :Comparable<NormalAlarmClock> {
    override fun compareTo(other: NormalAlarmClock): Int {
        return toString().compareTo(other.toString())
    }

    @PrimaryKey(autoGenerate = true)
    var id: Long = 0

    override fun toString(): String {
        val simpleDateFormat = SimpleDateFormat("aa h : mm")
        return simpleDateFormat.format(Date(0,0,0,hour,minute))
    }


}

